package com.tanhua.server.service;

import com.tanhua.dubbo.api.UserLocationApi;
import com.tanhua.model.vo.ErrorResult;
import com.tanhua.server.exception.BusinessException;
import com.tanhua.server.interceptor.UserHolder;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class BaiduService {


    @DubboReference
    private UserLocationApi userLocationApi;
    /*更新位置*/
    public void updateLocation(Double longitude, Double latitude, String address) {
      //获取用户自身id
        Long userId = UserHolder.getUserId();
        Boolean aBoolean = userLocationApi.updateLocation(userId, longitude, latitude, address);
        if(!aBoolean) {
            throw  new BusinessException(ErrorResult.error());
        }

    }


}
